package com.jeasonzhao.report.engine.irp;

import com.jeasonzhao.report.engine.ReportUserInfo;
import com.jeasonzhao.report.model.Report;
import com.jeasonzhao.report.exceptions.SQLReportException;

public interface IParameterValueCollector
{
    /**
     * Step 0: setup report from external parameter collector
     * @return Report Report
     * @throws ParamCollectException
     */
    public Report setupReport()
        throws SQLReportException;

    /**
     * Step 1: Collect all parameters' value
     * @param report Report Report
     * @return boolean Did we collected all parameters?
     * @throws ParamCollectException
     */
    public boolean collectParameters(Report report,ReportUserInfo user)
        throws SQLReportException;

    /**
     * Step 2: Get the pagesize of the report, it could be dynamic in runtime.
     * @param report Report Report
     * @return int The amount of rows for each page.
     * @throws ParamCollectException
     */
    public int getPageSize(Report report)
        throws SQLReportException;

    /**
     * Step 3: Get the page number of the current page
     * @param report Report
     * @return int The page number.
     * @throws ParamCollectException
     */
    public int getPageNo(Report report)
        throws SQLReportException;

    /**
     * Step 4: Get the render key,it might be "Excel","HTML","PDF" and so on.
     * @return String The render key
     */
    public String getRenderKey();

    /**
     * Step 5: Collecting sort setting and filters.
     * @param report Report
     */
    public void collectDynQuerySettings(Report report)
        throws SQLReportException;

    /**
     * Step 6: Clean after the report has been executed.
     * @param report Report
     */
    public void tearDown(Report report);
}
